<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<script type="text/javascript">
	function settingConfigTree_onNodeClick(event, treeId, treeNode) {
		//alert(treeNode.treenodePath);
		//alert(	JSON.stringify(treeNode));

		settingConfigGrid.search({
			"field" : "treenode_path",
			"op" : "bw",
			"data" : treeNode.treenodePath
		});
	}
	
	function getSettingConfigTreeNode() {
		var node = settingConfigTree.getSelectedNode();

		if (node !=undefined) {
			return "parentId=" + node.id;
		}
		isperp.alert("请选择节点！");
		return false;
	}
</script>
<div class="box no-border clearfix">

	<div class="box-left" style="width:280px">
		<isperp:tree id="settingConfigTree"
			cusEditUrl="app/settingConfig/edit"
			cusDeleteUrl="app/settingConfig/delete">
			<isperp:async enable="true" url="app/settingConfig/getTree?showRoot=1">
			</isperp:async>
			<isperp:callback onClick="settingConfigTree_onNodeClick">
			</isperp:callback>
			<isperp:edit enable="true" showRemoveBtn="false"
				showRenameBtn="false"></isperp:edit>
			<isperp:view showTitle="false" addHoverDom="true"
				removeHoverDom="true"></isperp:view>
		</isperp:tree>
	</div>
	<div class="box-right" style="margin-left:290px">

		<div class="box no-border">
			<div class="header">
				<h2>配置项定义</h2>
			</div>

			<isperp:grid url="app/settingConfig/list" gridId="settingConfigGrid"
				gridTitle="${pageTitle}" cusFormatterActions="true"
				showSearchbar="false" cusEditUrl="app/settingConfig/edit"
				cusDialogSize="normal" cusDeleteUrl="app/settingConfig/delete"
				ondbClickRowEvent="settingConfigGrid.edit(rowid);"
				beforeCreateAction="getSettingConfigTreeNode();"
				afterActionsSuccess="settingConfigTree.reload();">

				<jsp:attribute name="toolbar">
				<isperp:toolbar id="settingConfigToolbar">
					<isperp:button id="settingConfigCreate" cssClass="nui-mainbtn"
							icon="icon-plus" text="新增下级菜单"
							onclick="settingConfigGrid.create();"></isperp:button>
				</isperp:toolbar>
				</jsp:attribute>

				<jsp:body> 
					<isperp:column name="id" title="id" hidden="true"></isperp:column>
					<isperp:column name="name" title="名称" width="100">
					</isperp:column>
					<isperp:column name="code" title="编码" width="100">
					</isperp:column>
					<isperp:column name="treenodeNamePath" title="路径" width="200">
					</isperp:column>
					<isperp:column name="url" title="节链接地址" width="200">
					</isperp:column>
					<isperp:column name="open" title="展开" width="50" align="center"
						formatter="checkbox">
					</isperp:column>
						<isperp:column name="orderNum" title="排列顺序" width="80">
					</isperp:column>
				</jsp:body>

			</isperp:grid>
		</div>
	</div>
</div>
